<template>
  <div>
    <!-- 头部 商家 -->
    <Header></Header>
    <div class="tabs">
      <ul>
        <li>
          <router-link to="/goods">商品</router-link>
        </li>
        <li>
          <router-link to="/rating">评价</router-link>
        </li>
        <li>
          <router-link to="/seller">商家</router-link>
        </li>
      </ul>
      <router-view></router-view>
    </div>
    <div class="carList"  v-show="$store.state.show">
      <div class="mask"></div>
      <ul>
        <p class="car">购物车<span @click="kong()">清空</span></p>
        <li v-for="item in carList" :key="item.name" >
          <p class="name" v-show="!item.count == 0">{{ item.name }}</p>
          <span v-show="!item.count == 0">¥{{ item.price * item.count }}</span>
          <Btns v-show="!item.count == 0" :item="item" class="btn"></Btns>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import Header from "./views/header.vue";
import Btns from "./views/tabs/btns.vue";
import { mapState } from "vuex";

export default {
  // 注册
  components: {
    // 头部
    Header,
    Btns,
  },
  computed: {
    ...mapState(["carList"]),

  },
  methods:{
    kong(){
            for(let i = 0;i<this.carList.length;i++){
                this.carList[i].count = 0
            }
        }
  }


};
</script>

<style lang="less" scoped>
.carList {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    .mask {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: rgba(7, 17, 27, 0.6);
    }
    ul {
      position: absolute;
      bottom: 13.333vw;
      width: 100%;
      left: 0;
      height: 63.333vw;
      background: white;
      overflow: scroll;
      .car{
        background-color: #f3f5f7;
        font-size: 3.733vw;
        font-weight: 200;
        color: rgb(7,17,27);
        line-height: 10.667vw;
        padding-left: 4.8vw;
        border-bottom: 1px solid rgba(7, 17,27, 0.1);
        span{
          color: rgb(0, 160, 220);
          font-size: 3.2vw;
          position: absolute;
          right:4.8vw;
        }
      }
      li{
        line-height: 12.8vw;
        font-size: 3.733vw;
        font-weight: bold;
        display: flex;
        border-bottom: 1px solid rgba(7, 17,27, 0.1);
        .name{
          flex: 1;
          padding-left: 3.667vw;
        }
        span{
          color: red;
          margin: 0vw 3.2vw 0vw 4.8vw;
        }
        .btn{
          font-size: 3.2vw;
          margin: 3.067vw 3.333vw 3.2vw 0vw;
        }
      }
    }
  }
.tabs {
  height: 10.667vw;

  ul {
    display: flex;
    border-bottom: 1px solid rgba(7, 17, 27, 0.1);

    li {
      flex: 1;
      text-align: center;
      display: flex;
      font-size: 3.733vw;
      font-weight: 200;
      line-height: 10.667vw;

      &:hover {
        color: red;
      }
    }

    a {
      flex: 1;
    }
  }
}

</style>
